roundedbox: Remove _gtk_rounded_box_path()
authorBenjamin Otte <otte@redhat.com>
Tue, 13 Dec 2016 20:00:28 +0000 (21:00 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 20 Dec 2016 17:01:10 +0000 (18:01 +0100)
Use gsk_rounded_rect_path() instead.

That's a private GSK function, be we can just include its header.

gtk/gtkcssshadowvalue.c
gtk/gtkpopover.c
gtk/gtkrender.c
gtk/gtkrenderbackground.c
gtk/gtkrenderborder.c
gtk/gtkroundedbox.c
gtk/gtkroundedboxprivate.h

index fa68e855ec93486c2d91cadf2eec3ea7a9f71707..24e852b06e1484162ae541ee343b4baf31c42c10 100644 (file)
@@ -30,6 +30,8 @@
 #include "gtkrenderprivate.h"
 #include "gtkpango.h"
 
+#include "gsk/gskroundedrectprivate.h"
+
 #include <math.h>
 
 struct _GtkCssValue {
@@ -653,7 +655,7 @@ draw_shadow (const GtkCssValue   *shadow,
     shadow_cr = cr;
 
   cairo_set_fill_rule (shadow_cr, CAIRO_FILL_RULE_EVEN_ODD);
-  _gtk_rounded_box_path (box, shadow_cr);
+  gsk_rounded_rect_path (box, shadow_cr);
   if (shadow->inset)
     _gtk_rounded_box_clip_path (clip_box, shadow_cr);
 
@@ -808,7 +810,7 @@ draw_shadow_corner (const GtkCssValue     *shadow,
       mask_cr = cairo_create (mask);
       _gtk_rounded_box_init_rect (&corner_box, clip_radius, clip_radius, 2*drawn_rect->width, 2*drawn_rect->height);
       corner_box.corner[0] = box->corner[corner];
-      _gtk_rounded_box_path (&corner_box, mask_cr);
+      gsk_rounded_rect_path (&corner_box, mask_cr);
       cairo_fill (mask_cr);
       _gtk_cairo_blur_surface (mask, radius, GTK_BLUR_X | GTK_BLUR_Y);
       cairo_destroy (mask_cr);
@@ -914,13 +916,13 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue   *shadow,
 
   if (shadow->inset)
     {
-      _gtk_rounded_box_path (padding_box, cr);
+      gsk_rounded_rect_path (padding_box, cr);
       cairo_clip (cr);
     }
   else
     {
       cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
-      _gtk_rounded_box_path (padding_box, cr);
+      gsk_rounded_rect_path (padding_box, cr);
       outside = spread + clip_radius + MAX (fabs (x), fabs (y));
       clip_box = *padding_box;
       _gtk_rounded_box_grow (&clip_box, outside, outside, outside, outside);
index 5112ba5813835fec3e6688bbabeb85d12f7999ad..298d245b376160c908aa7c510b560b6cafb3d725 100644 (file)
 #include "gtkprogresstrackerprivate.h"
 #include "gtksettingsprivate.h"
 
+#include "gsk/gskroundedrectprivate.h"
+
 #ifdef GDK_WINDOWING_WAYLAND
 #include "wayland/gdkwayland.h"
 #endif
@@ -920,7 +922,7 @@ gtk_popover_fill_border_path (GtkPopover *popover,
   _gtk_rounded_box_apply_border_radius_for_style (&box,
                                                   gtk_style_context_lookup_style (context),
                                                   0);
-  _gtk_rounded_box_path (&box, cr);
+  gsk_rounded_rect_path (&box, cr);
   cairo_fill (cr);
 }
 
index bd48057b9de202494d5abbfbd933554ce1e29ec0..e23d712406236ac953baadf1f56e456ee9f1d08d 100644 (file)
@@ -35,6 +35,8 @@
 #include "gtkrendericonprivate.h"
 #include "gtkstylecontextprivate.h"
 
+#include "gsk/gskroundedrectprivate.h"
+
 #include "fallback-c89.c"
 
 static void
@@ -994,5 +996,5 @@ gtk_render_content_path (GtkStyleContext *context,
                            _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100)
                            + _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_PADDING_LEFT), 100));
 
-  _gtk_rounded_box_path (&box, cr);
+  gsk_rounded_rect_path (&box, cr);
 }
index b4091f68040afed1a3bcd1f15a132323d355b007..658bfd1fa128f6545e5843517757c268cf6837f1 100644 (file)
@@ -40,6 +40,8 @@
 
 #include <gdk/gdk.h>
 
+#include "gsk/gskroundedrectprivate.h"
+
 /* this is in case round() is not provided by the compiler, 
  * such as in the case of C89 compilers, like MSVC
  */
@@ -67,7 +69,7 @@ _gtk_theming_background_paint_color (GtkThemingBackground *bg,
      (gtk_css_style_get_value (bg->style, GTK_CSS_PROPERTY_BACKGROUND_CLIP), 
       n_values - 1));
 
-  _gtk_rounded_box_path (&bg->boxes[clip], cr);
+  gsk_rounded_rect_path (&bg->boxes[clip], cr);
   gdk_cairo_set_source_rgba (cr, bg_color);
   cairo_fill (cr);
 }
@@ -161,7 +163,7 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
 
   cairo_save (cr);
 
-  _gtk_rounded_box_path (
+  gsk_rounded_rect_path (
       &bg->boxes[
           _gtk_css_area_value_get (
               _gtk_css_array_value_get_nth (
index a848573a7f4149a186abca09b566dcd944bc7129..7c418616a53fbef8a28777eb7f2f5314f2a4d7e8 100644 (file)
@@ -36,6 +36,8 @@
 #include "gtkhslaprivate.h"
 #include "gtkroundedboxprivate.h"
 
+#include "gsk/gskroundedrectprivate.h"
+
 /* this is in case round() is not provided by the compiler, 
  * such as in the case of C89 compilers, like MSVC
  */
@@ -373,8 +375,8 @@ render_frame_fill (cairo_t        *cr,
     {
       gdk_cairo_set_source_rgba (cr, &colors[0]);
 
-      _gtk_rounded_box_path (border_box, cr);
-      _gtk_rounded_box_path (&padding_box, cr);
+      gsk_rounded_rect_path (border_box, cr);
+      gsk_rounded_rect_path (&padding_box, cr);
       cairo_fill (cr);
     }
   else
@@ -501,7 +503,7 @@ render_frame_stroke (cairo_t        *cr,
           length += _gtk_rounded_box_guess_length (&stroke_box, i);
         }
 
-      _gtk_rounded_box_path (&stroke_box, cr);
+      gsk_rounded_rect_path (&stroke_box, cr);
       gdk_cairo_set_source_rgba (cr, &colors[0]);
       set_stroke_style (cr, border_width[0], stroke_style, length);
       cairo_stroke (cr);
index 8231db45a02232e548b174eb2e49e3f3fcd27c44..73b9746489838ade7f4646e8df56305b5d750aee 100644 (file)
@@ -345,40 +345,6 @@ _cairo_ellipsis_negative (cairo_t *cr,
   cairo_set_matrix (cr, &save);
 }
 
-void
-_gtk_rounded_box_path (const GskRoundedRect *box,
-                       cairo_t              *cr)
-{
-  cairo_new_sub_path (cr);
-
-  _cairo_ellipsis (cr,
-                   box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width,
-                   box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height,
-                   box->corner[GSK_CORNER_TOP_LEFT].width,
-                   box->corner[GSK_CORNER_TOP_LEFT].height,
-                   G_PI, 3 * G_PI_2);
-  _cairo_ellipsis (cr, 
-                   box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
-                   box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
-                   box->corner[GSK_CORNER_TOP_RIGHT].width,
-                   box->corner[GSK_CORNER_TOP_RIGHT].height,
-                   - G_PI_2, 0);
-  _cairo_ellipsis (cr,
-                   box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
-                   box->bounds.origin.y + box->bounds.size.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
-                   box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
-                   box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
-                   0, G_PI_2);
-  _cairo_ellipsis (cr,
-                   box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
-                   box->bounds.origin.y + box->bounds.size.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height,
-                   box->corner[GSK_CORNER_BOTTOM_LEFT].width,
-                   box->corner[GSK_CORNER_BOTTOM_LEFT].height,
-                   G_PI_2, G_PI);
-
-  cairo_close_path (cr);
-}
-
 double
 _gtk_rounded_box_guess_length (const GskRoundedRect *box,
                                GtkCssSide            side)
index f4a09101273ed408b659b91bf6efaa01ec491609..957bb3e4cadd317288b78bcd069c3fb569d480ee 100644 (file)
@@ -56,8 +56,6 @@ void            _gtk_rounded_box_shrink                         (GskRoundedRect
 double          _gtk_rounded_box_guess_length                   (const GskRoundedRect   *box,
                                                                  GtkCssSide              side);
 
-void            _gtk_rounded_box_path                           (const GskRoundedRect   *box,
-                                                                 cairo_t                *cr);
 void            _gtk_rounded_box_path_side                      (const GskRoundedRect   *box,
                                                                  cairo_t                *cr,
                                                                  GtkCssSide              side);